package com.woniuxy01;

import java.util.Arrays;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入人数");
        int personNum=sc.nextInt();
        System.out.println("输入倒霉数字");
        int unlucyNum=sc.nextInt();
        boolean[] persons=new boolean[personNum];
        int leftPersonNum=personNum;
        int count=0;
        for(int i=0;i<personNum;i++){
            persons[i]=true;
        }
        //外层循环控制轮数
        do{
            //内层循环报一轮
            for(int i=0;i<persons.length;i++){
                //幸存状态才能报数
                if(persons[i]){
                    count++;
                    //报数以后是否被淘汰
                    if(count%unlucyNum==0){
                        persons[i]=false;
                        leftPersonNum--;
                    }
                }
            }
        }while (leftPersonNum>1);

        System.out.println(Arrays.toString(persons));
    }
}
